from django.contrib.auth.models import User, Group
from rest_framework import serializers

from article.models import Article
from quickstart.serializers import UserSerializer


class ArticleSerializer(serializers.HyperlinkedModelSerializer):
    author = UserSerializer(read_only = True)
    class Meta:
        model = Article  # 对哪个模型序列化?
        # fields = ['title', 'created']  # 序列化是显示哪些属性
        fields = '__all__'  # 将fields属性设置成'__all__'来表明使用模型中的所有字段。
        #exclude = ('updated', 'created')  # 将exclude属性设置成一个从序列化器中排除的字段列表。元组只有一个元素时，一定要加逗号

